<style>
    .pagination{ float:right;}
</style>
<div class="content" {if condition="$count eq 0"}style="display:none;" {/if}>
    <div class="panel panel-default panel-intro">
        <div class="panel-body">
            <div id="" class="tab-content">
                <div class="tab-pane fade active in" id="one">
                    <div class="widget-body no-padding">
                        <div class="bootstrap-table">
                            <div class="fixed-table-toolbar">
                                <form action="" method="post">
                                    <table id="" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                        <thead>

                                        <tr>
                                            <th class="bs-checkbox " style="text-align: center; vertical-align: middle;width:3%;height: 45px;" data-field="0">

                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="fid">
                                                <div class="th-inner ">ID</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="fid">
                                                <div class="th-inner ">订单编号</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:15%;" data-field="title">
                                                <div class="th-inner ">产品名称</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">团期出发时间</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner "> 下单时间</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">价格</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">产品编号</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">订单产品类型</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">总人数</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                           <!-- <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">成人数</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">佣金折扣</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">同业类型</div>
                                                <div class="fht-cell"></div>
                                            </th>-->
                                            <th style="text-align: center; vertical-align: middle;width: 20%;" data-field="operate">
                                                <div class="th-inner ">操作</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody data-listidx="0">
                                        {volist name="orderPoolList" id="vo"}
                                        <tr data-index="0">
                                            <td class="bs-checkbox "></td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.id}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.orderno}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.p_name}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.g_time|date="Y-m-d",###}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.c_time|date="Y-m-d H:i:s",###}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.payprice}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.p_no}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.p_type}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.p_num}
                                            </td>
                                           <!-- <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.c_num}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.commission}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.distributortype}
                                            </td>-->
                                            <td style="text-align: center; vertical-align: middle; ">
                                                <a href="javascript:;" class="btn btn-success btn-edit btn-disabled" title="认领订单" onclick="claim('{$vo.id}');"><i class="fa fa-pencil"></i> 认领订单</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                </form>
                                <div>{$pagelist}</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>



<div class="content">
    <div class="panel panel-default panel-intro">
        <div class="panel-body">
            <div id="" class="tab-content">
                <div class="tab-pane fade active in" id="one">
                    <div class="widget-body no-padding">
                        <div class="bootstrap-table">
                            <div class="fixed-table-toolbar">
                                <form action="" method="post">
                                    <table id="" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                        <thead>

                                        <tr>
                                            <th class="bs-checkbox " style="text-align: center; vertical-align: middle;width:3%;height: 45px;" data-field="0">

                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="fid">
                                                <div class="th-inner ">ID</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="fid">
                                                <div class="th-inner ">订单编号</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:15%;" data-field="title">
                                                <div class="th-inner ">产品名称</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">团期出发时间</div>
                                                <div class="fht-cell"></div>
                                            </th>

                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">订单过期时间</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">价格</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">订单产品类型</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width:6%;" data-field="type">
                                                <div class="th-inner ">分期数据</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                            <th style="text-align: center; vertical-align: middle;width: 20%;" data-field="operate">
                                                <div class="th-inner ">操作</div>
                                                <div class="fht-cell"></div>
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody data-listidx="0">
                                        {volist name="orderList" id="vo"}
                                        <tr data-index="0">
                                            <td class="bs-checkbox "></td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.id}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.orderno}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.s_name}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.g_time|date="Y-m-d",###}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.e_time|date="Y-m-d H:i:s",###}
                                            </td>

                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.payprice}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {$vo.p_type}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                {volist name="$vo['pay_list']" id="pay" key="k"}
                                                <span>第{$k}期:{$pay.price_c}</span><br/>
                                                {/volist}
                                            </td>
                                            <td style="text-align: center; vertical-align: middle; ">
                                                <a href="/index/order/order_detail_show?id={$vo.id}" class="btn btn-success btn-edit btn-disabled" title="编辑"><i class="fa fa-pencil"></i> 订单详情</a>
                                                <a href="/admin/order/deleteorder?orderid={$vo.id}" class="btn btn-success btn-edit btn-disabled" title="编辑"><i class="fa fa-pencil"></i> 删除（回收）订单</a>
                                                <a href="/admin/order/order_supplement_list?order_id={$vo.id}" class="btn btn-success btn-edit btn-disabled" title="编辑"><i class="fa fa-pencil"></i> 自费项目维护</a>

                                                <a href="/admin/order/order_reduced?orderid={$vo.id}" class="btn btn-success btn-edit btn-disabled" title="编辑"><i class="fa fa-pencil"></i> 订单优惠项目维护</a>
                                                <input type="number" name="installment"  value="" style="width:40px;" class="installment" min="0"/>
                                                <a href="javascript:;" class="btn btn-success btn-add btn-disabled" title="拆分" onclick="sliptList(this,'{$vo.id}')"><i class="fa fa-pencil"></i> 订单拆分</a>

                                                <input type="number" name="delay"  value="" style="width:40px;" class="delay" min="0"/>天
                                                <a href="javascript:;" class="btn btn-success btn-add btn-disabled" title="拆分" onclick="delay(this,'{$vo.id}')"><i class="fa fa-pencil"></i>订单延期</a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                    </table>
                                    <div>{$page}</div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<script>
    function sliptList(obj,id){
        var installment=$(obj).prev("input[name='installment']").val();
        //alert(installment);
        if(installment<1){
            layer.alert("数据不合法！");
            return;
        }
        window.location.href="/admin/order/split_index?id="+id+"&installment="+installment;
    }

    function claim(id){
        $.ajax({
            type:'post',
            dataType:'json',
            data:{"id":id},
            url:"/admin/order/claim",
            success:function(data){
                if(data.status==1){
                    layer.alert(data.message,
                            {closeBtn:0},
                            function(){
                                window.location.reload();
                            })
                }else{
                    layer.alert(data.message);
                }
            }
        })

    }

    function delay(obj,id){
        var delay=$(obj).prev("input[name='delay']").val();
        if(delay<1){
            alert("请输入正确延期时间");
            return;
        }
        $.ajax({
            type:'post',
            dataType:'json',
            url:'/admin/order/delay',
            data:{"id":id,"delay":delay},
            success:function(data){
                if(data.status){
                    alert(data.message);
                    location.reload();
                }else{
                    alert(data.message);
                }
            }
        })
    }
</script>
